package com.ylr.auth;

/**
 * @ClassName AuthApplication
 * @Description TODO
 * @Author 11
 * @Date 2021/4/12 16:55
 * @Version 1.0
 */

import com.ylr.auth.result.Result;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;


@SpringBootApplication
@EnableDiscoveryClient
public class AuthApplication {
    public static void main(String[] args) {
        SpringApplication.run(AuthApplication.class,args);
    }


    @RefreshScope
    @RestController
    public class Controller{

        @Value("${rsa.publicKey}")
        public String publicKey;

        @GetMapping(value = "/publicKey")
        public Result getPublicKey(){

            return Result.success(this.publicKey);
        }


        @GetMapping(value = "/echo/{string}")
        public String echo(@PathVariable String string){

            return "hello Nacos Discovery "+string;
        }
    }

}